import java.io.File;

/**
 * @ClassName FileDemo02
 * @Description File 常用方法
 * @Author Li
 * @Date 2022/8/10 9:44
 * @ModifyDate 2022/8/10 9:44
 * @Version 1.0
 */
public class FileDemo02 {
    public static void main(String[] args) {
        File file1 = new File("D:\\A\\a.txt");
        System.out.println("文件的绝对路径：" + file1.getAbsolutePath());
        System.out.println("文件的构造路径：" + file1.getPath());
        System.out.println("文件名称：" + file1.getName());
        System.out.println("文件长度：" + file1.length());
        System.out.println("===========================");
        File file2 = new File("D:\\A");
        System.out.println("目录的绝对路径：" + file2.getAbsolutePath());
        System.out.println("目录的构造路径：" + file2.getPath());
        System.out.println("目录名称：" + file2.getName());
        System.out.println("目录长度：" + file2.length());
    }
}
